﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace wms.Common
{
    public class Property
    {
        public static string Get(string key) {
            return DBHelper.GetDataSingle("select t.property_value from t_property t where t.property_key = @key", new SqlParameter[] { new SqlParameter("@key",key) }) as string;
        }

        public static void Save(string key,string value)
        {
            if (string.IsNullOrWhiteSpace(key)) {
                MessageBox.Show("key不能为空");
                return;
            }
            DBHelper.ExcuteSQL("delete from t_property where property_key = @key", new SqlParameter[] { new SqlParameter("@key", key) });
            DBHelper.ExcuteSQL("insert into t_property(property_key,property_value) values(@key,@value)", new SqlParameter[] { new SqlParameter("@key", key), new SqlParameter("@value", value) });
        }
    }
}
